<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>老人管理-老人信息-绑定护工</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="/layertwo-assets/css/bootstrap.min.css" rel="stylesheet">
	<link href="/layertwo-assets/css/style.css" rel="stylesheet">
	<link href="/layertwo-assets/css/font-awesome.css" rel="stylesheet">
</head>
<body>
	<div class="container-fluid">
		<div class="om-ctl-mes">
			<div class="title">
				<div class="col-xs-12"><span class="fa fa-list-ul"> 老人管理</span><b class="fa fa-caret-right"></b><i><a href="../老人信息.html">老人信息</a></i><b class="fa fa-caret-right"></b><i>新增老人</i></div>
			</div>
            <div class="bind-container">
          <table class="table bind-content">
                 <thead>
                  <tr>
                    <th width="150">护工姓名</th>
                    <th width="150">护理老人</th>
                    <th width="800"></th>
                    <th>操作</th>
                  </tr>
              </thead>
             <tbody>
                <?foreach($tDatas as $tRow){?>
                  <tr>
                    <td align="left"><?=empty($tRow['name'])?'未知姓名':$tRow['name']?></td>
                    <td><?=$tRow['w_cnt']?>人</td>
                    <td>
                        <ul>
                            <li>护理病例</li>
                            <?php $arr = explode(',', $tRow['cases']);
                            foreach ($arr as $key => $val) {?>
                            <li><span><?=$val?></span></li>  
                            <?}?>
                        </ul>
                        <ul>
                            <li>职业技能</li>
                            <?php $arrs = explode(',', $tRow['skill']);
                            foreach ($arrs as $key => $val) {?>
                            <li><span><?=$val?></span></li>  
                            <?}?>
                        </ul>
                    </td>
                    <td>
                        <? if($tRow['tBD']==1){?>
                        <button style="color:black;background-color: #A8A8A8 " type="button" data="<?=$tRow['id']?>" class='bound'>已绑</button>
                        <?}else{?>
                        <button type="button" data="<?=$tRow['id']?>" class='bound'>绑定</button>
                        <?}?>
                    </td>
                  </tr>
                  <?}?>
             </tbody>
          </table>
          </div>
		</div>
    </div>
    <script type="text/javascript" src="/layertwo-assets/js/jquery.min.js"></script>
    <script>
    $('.bound').each(function(){
    $(this).click(function(){
      var sw_id = $(this).attr('data');
            var sid = GetQuery('id');
            $.post('/admin_senior/bound',{sw_id:sw_id,sid:sid},function(obj){
        alert(obj.msg);window.location.href = '/admin_senior';  
      });
    });   
  });
  /*获取地址栏参数*/
  function GetQuery(key){
    var search = location.search.slice(1);//得到get方式提交的查询字符串
    var arr = search.split("&");
    for(var i = 0; i < arr.length; i++){
      var ar = arr[i].split("=");
      if(ar[0] == key){
        return ar[1];
      }
    }
  }
    </script>
</body>
</html>